load("@bazel_gomock//:gomock.bzl", "gomock")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "tests",
    testonly = 1,
    srcs = [
        "acceptance.go",
        "activerecord.go",
        "activerecord_blocklist.go",
        "admission_control.go",
        "admission_control_database_drop.go",
        "admission_control_disk_bandwidth_overload.go",
        "admission_control_elastic_backup.go",
        "admission_control_elastic_cdc.go",
        "admission_control_elastic_io.go",
        "admission_control_follower_overload.go",
        "admission_control_index_backfill.go",
        "admission_control_index_overload.go",
        "admission_control_intent_resolution.go",
        "admission_control_latency.go",
        "admission_control_multi_store_overload.go",
        "admission_control_multitenant_fairness.go",
        "admission_control_row_level_ttl.go",
        "admission_control_snapshot_overload.go",
        "admission_control_snapshot_overload_excise.go",
        "admission_control_tpcc_overload.go",
        "allocation_bench.go",
        "allocator.go",
        "alterpk.go",
        "asyncpg.go",
        "asyncpg_blocklist.go",
        "awsdms.go",
        "backup.go",
        "backup_fixtures.go",
        "backup_restore_roundtrip.go",
        "buffered_logging.go",
        "build_info.go",
        "canary.go",
        "cancel.go",
        "cdc.go",
        "cdc_bench.go",
        "cdc_filtering.go",
        "cdc_helper.go",
        "cdc_stats.go",
        "chaos.go",
        "clearrange.go",
        "cli.go",
        "clock_jump_crash.go",
        "clock_monotonic.go",
        "clock_util.go",
        "cluster_init.go",
        "cluster_to_cluster.go",
        "connection_latency.go",
        "copy.go",
        "copyfrom.go",
        "costfuzz.go",
        "decommission.go",
        "decommission_self.go",
        "decommissionbench.go",
        "disagg_rebalance.go",
        "disk_full.go",
        "disk_stall.go",
        "django.go",
        "django_blocklist.go",
        "dotnet_helpers.go",
        "drain.go",
        "drop.go",
        "drt.go",
        "encryption.go",
        "event_log.go",
        "export_parquet.go",
        "failover.go",
        "fixtures.go",
        "follower_reads.go",
        "go_helpers.go",
        "gopg.go",
        "gopg_blocklist.go",
        "gorm.go",
        "gorm_blocklist.go",
        "gossip.go",
        "hibernate.go",
        "hibernate_blocklist.go",
        "hotspotsplits.go",
        "import.go",
        "import_cancellation.go",
        "inconsistency.go",
        "indexes.go",
        "inverted_index.go",
        "jasyncsql.go",
        "jasyncsql_blocklist.go",
        "java_helpers.go",
        "jepsen.go",
        "jobs.go",
        "jobs_util.go",
        "knex.go",
        "kv.go",
        "kvbench.go",
        "large_schema_benchmark.go",
        "latency_verifier.go",
        "lease_preferences.go",
        "ledger.go",
        "libpq.go",
        "libpq_blocklist.go",
        "limit_capacity.go",
        "liquibase.go",
        "liquibase_blocklist.go",
        "logical_data_replication.go",
        "loss_of_quorum_recovery.go",
        "many_splits.go",
        "mismatched_locality.go",
        "mixed_version_backup.go",
        "mixed_version_c2c.go",
        "mixed_version_cdc.go",
        "mixed_version_change_replicas.go",
        "mixed_version_decl_schemachange_compat.go",
        "mixed_version_decommission.go",
        "mixed_version_import.go",
        "mixed_version_job_compatibility_in_declarative_schema_changer.go",
        "mixed_version_multi_region.go",
        "mixed_version_schemachange.go",
        "mixed_version_sql_stats.go",
        "multi_region_system_database.go",
        "multi_store_remove.go",
        "multiregion_leasing.go",
        "multitenant.go",
        "multitenant_distsql.go",
        "multitenant_shared_process.go",
        "multitenant_tpch.go",
        "multitenant_upgrade.go",
        "multitenant_utils.go",
        "mvcc_gc.go",
        "network.go",
        "nodejs_postgres.go",
        "npgsql.go",
        "npgsql_blocklist.go",
        "online_restore.go",
        "orm_helpers.go",
        "parsing_helpers.go",
        "pebble_write_throughput.go",
        "pebble_ycsb.go",
        "pg_regress.go",
        "pgjdbc.go",
        "pgjdbc_blocklist.go",
        "pgx.go",
        "pgx_blocklist.go",
        "pop.go",
        "process_lock.go",
        "prune_dangling_snapshots_and_disks.go",
        "psycopg.go",
        "psycopg_blocklist.go",
        "query_comparison_util.go",
        "queue.go",
        "quit.go",
        "rapid_restart.go",
        "rebalance_load.go",
        "rebalance_stats.go",
        "registry.go",
        "replicagc.go",
        "restart.go",
        "restore.go",
        "roachmart.go",
        "roachtest.go",
        "ruby_pg.go",
        "ruby_pg_blocklist.go",
        "rust_postgres.go",
        "rust_postgres_blocklist.go",
        "schemachange.go",
        "schemachange_random_load.go",
        "scrub.go",
        "secondary_indexes.go",
        "sequelize.go",
        "slow_drain.go",
        "split.go",
        "sqlalchemy.go",
        "sqlalchemy_blocklist.go",
        "sqlsmith.go",
        "status_server.go",
        "sysbench.go",
        "tlp.go",
        "tombstones.go",
        "tpc_utils.go",
        "tpcc.go",
        "tpcdsvec.go",
        "tpce.go",
        "tpch_concurrency.go",
        "tpchbench.go",
        "tpchvec.go",
        "ts_util.go",
        "typeorm.go",
        "unoptimized_query_oracle.go",
        "util.go",
        "util_disk_usage.go",
        "util_if_local.go",
        "util_load_group.go",
        "validate_system_schema_after_version_upgrade.go",
        "versionupgrade.go",
        "ycsb.go",
    ],
    embedsrcs = [
        "ruby_pg_helpers.rb",
        "knexfile.js",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/blobs",
        "//pkg/ccl/changefeedccl",
        "//pkg/ccl/changefeedccl/cdctest",
        "//pkg/ccl/changefeedccl/changefeedbase",
        "//pkg/ccl/crosscluster/replicationutils",
        "//pkg/ccl/storageccl/engineccl/enginepbccl",
        "//pkg/cli",
        "//pkg/cli/clisqlclient",
        "//pkg/cloud",
        "//pkg/cloud/amazon",
        "//pkg/cloud/gcp",
        "//pkg/cmd/cmpconn",
        "//pkg/cmd/roachtest/cluster",
        "//pkg/cmd/roachtest/clusterstats",
        "//pkg/cmd/roachtest/grafana",
        "//pkg/cmd/roachtest/option",
        "//pkg/cmd/roachtest/registry",
        "//pkg/cmd/roachtest/roachtestutil",
        "//pkg/cmd/roachtest/roachtestutil/clusterupgrade",
        "//pkg/cmd/roachtest/roachtestutil/mixedversion",
        "//pkg/cmd/roachtest/spec",
        "//pkg/cmd/roachtest/test",
        "//pkg/gossip",
        "//pkg/internal/sqlsmith",
        "//pkg/internal/workloadreplay",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/multitenant/mtinfopb",
        "//pkg/roachpb",
        "//pkg/roachprod",
        "//pkg/roachprod/config",
        "//pkg/roachprod/errors",
        "//pkg/roachprod/install",
        "//pkg/roachprod/logger",
        "//pkg/roachprod/prometheus",
        "//pkg/roachprod/vm",
        "//pkg/security/username",
        "//pkg/server/authserver",
        "//pkg/server/serverpb",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/sem/tree",
        "//pkg/sql/ttl/ttlbase",
        "//pkg/storage",
        "//pkg/storage/enginepb",
        "//pkg/testutils",
        "//pkg/testutils/floatcmp",
        "//pkg/testutils/jobutils",
        "//pkg/testutils/release",
        "//pkg/testutils/sqlutils",
        "//pkg/ts/tspb",
        "//pkg/util",
        "//pkg/util/cancelchecker",
        "//pkg/util/ctxgroup",
        "//pkg/util/hlc",
        "//pkg/util/httputil",
        "//pkg/util/humanizeutil",
        "//pkg/util/intsets",
        "//pkg/util/ioctx",
        "//pkg/util/log",
        "//pkg/util/parquet",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/retry",
        "//pkg/util/search",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/uuid",
        "//pkg/util/version",
        "//pkg/workload",
        "//pkg/workload/debug",
        "//pkg/workload/histogram",
        "//pkg/workload/querybench",
        "//pkg/workload/tpcc",
        "//pkg/workload/tpcds",
        "//pkg/workload/tpch",
        "@com_github_aws_aws_sdk_go_v2_config//:config",
        "@com_github_aws_aws_sdk_go_v2_service_databasemigrationservice//:databasemigrationservice",
        "@com_github_aws_aws_sdk_go_v2_service_databasemigrationservice//types",
        "@com_github_aws_aws_sdk_go_v2_service_rds//:rds",
        "@com_github_aws_aws_sdk_go_v2_service_rds//types",
        "@com_github_aws_aws_sdk_go_v2_service_secretsmanager//:secretsmanager",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_cockroach_go_v2//crdb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_cockroachdb_ttycolor//:ttycolor",
        "@com_github_codahale_hdrhistogram//:hdrhistogram",
        "@com_github_dustin_go_humanize//:go-humanize",
        "@com_github_google_go_cmp//cmp",
        "@com_github_ibm_sarama//:sarama",
        "@com_github_jackc_pgtype//:pgtype",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_kr_pretty//:pretty",
        "@com_github_lib_pq//:pq",
        "@com_github_montanaflynn_stats//:stats",
        "@com_github_pmezard_go_difflib//difflib",
        "@com_github_prometheus_client_golang//api",
        "@com_github_prometheus_client_golang//api/prometheus/v1:prometheus",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_prometheus_common//model",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_protobuf//proto",
        "@org_golang_x_exp//maps",
        "@org_golang_x_oauth2//clientcredentials",
        "@org_golang_x_sync//errgroup",
    ],
)

go_test(
    name = "tests_test",
    srcs = [
        "blocklist_test.go",
        "cdc_helper_test.go",
        "drt_test.go",
        "query_comparison_util_test.go",
        "restore_test.go",
        "tpcc_test.go",
        "util_load_group_test.go",
        ":mocks_drt",  # keep
    ],
    embed = [":tests"],
    deps = [
        "//pkg/cmd/roachtest/option",
        "//pkg/cmd/roachtest/registry",
        "//pkg/cmd/roachtest/spec",
        "//pkg/roachprod/logger",
        "//pkg/roachprod/prometheus",
        "//pkg/testutils/skip",
        "//pkg/util/leaktest",
        "//pkg/util/version",
        "@com_github_golang_mock//gomock",
        "@com_github_google_go_github//github",
        "@com_github_prometheus_client_golang//prometheus/promauto",
        "@com_github_prometheus_common//model",
        "@com_github_stretchr_testify//require",
        "@org_golang_x_oauth2//:oauth2",
    ],
)

gomock(
    name = "mocks_drt",
    out = "drt_generated_test.go",
    interfaces = ["Client"],
    library = "//pkg/roachprod/prometheus",
    package = "tests",
    visibility = [
        ":__pkg__",
        "//pkg/gen:__pkg__",
    ],
)
